package com.dwxt.cdms.api.controller;

import com.dwxt.cdms.entity.Customer;
import com.dwxt.cdms.service.CustomerService;
import com.dwxt.common.annotation.ValidateFiled;
import com.dwxt.common.annotation.ValidateGroup;
import com.dwxt.common.base.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cdms/customerForWx")
public class CustomerForWxController {

    @Autowired
    private CustomerService customerService;


    /**
     * 新增/修改客户
     * 微信小程序
     * @param customer
     * @return
     */
    @RequestMapping("/UpdateForWx")
    @ValidateGroup(fileds = {
            @ValidateFiled(index = 0, filedName = "name", notNull = true),
            @ValidateFiled(index = 0, filedName = "phone", notNull = true)}
    )
    public BaseResult insertOrUpdateForWX(Customer customer) {
        return customerService.UpdateForWx(customer);
    }
}
